
#include "muxer_and_demuxer.hpp"
#include <cstddef>


extern "C"
{
    #include <libavcodec/avcodec.h>
    #include <libavutil/avutil.h>
    #include <libavcodec/codec.h>
    #include <libavformat/avformat.h>
}

BaseStream::BaseStream()
{

}

BaseStream * BaseStream::CreateMediaStreamByMediaType(int type)
{
    BaseStream * stream = NULL;
    switch (type) 
    {
        case AVMEDIA_TYPE_VIDEO:
        {
            stream = new VideoStream();
            break;
        }
        case AVMEDIA_TYPE_AUDIO:
        {

            stream = new AudioStream();
            break;
        }
        default:
        {
            break;
        }
    }
    return stream;
}

VideoStream::VideoStream()
{

}

const AVCodec * VideoStream::AddStream(AVFormatContext * format_ctx, const std::string &codec_name)
{
    const AVCodec * codec = avcodec_find_encoder_by_name(codec_name.c_str());
    if (codec)
    {
        avformat_new_stream(format_ctx, codec);
    }
}

AudioStream::AudioStream()
{

}

const AVCodec * AudioStream::AddStream(AVFormatContext * format_ctx,const std::string &codec_name)
{

} 